/*
 * 天虹商场股份有限公司版权所有.
 */
package com.rainbow.mybatis.mybatisinterceptor;

import com.rainbow.mybatis.config.MapperRegistory;
import com.rainbow.mybatis.plugin.Interceptor;
import com.rainbow.mybatis.plugin.Invocation;
import com.rainbow.mybatis.plugin.Plugin;
import com.rainbow.mybatis.statement.StatementHandler;
import org.apache.ibatis.plugin.Intercepts;
import org.apache.ibatis.plugin.Signature;

import java.util.Properties;

/**
 * TODO
 *
 * @author 黄明坤
 * @version 1.0.0
 * @date 2020/6/29
 */
@Intercepts({ @Signature(type = StatementHandler.class, method = "query", args = {MapperRegistory.MapperData.class, Object.class}) })
public class TestTwoMybatisInterceptor implements Interceptor {

    @Override
    public Object intercept(Invocation invocation) throws Throwable {
        System.out.println("我的StatementHandler拦截器！");
        //执行代理类中的方法
        return invocation.proceed();
    }

    @Override
    public Object plugin(Object target) {
        return Plugin.wrap(target,this);
    }

    @Override
    public void setProperties(Properties properties) {
    }
}
